﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WrongTextSpawner : MonoBehaviour
{
    private const float RandomOffset = 1f;
    private const float SpawnInterval = 1f;

    public int SpawnNum = 10;
    private int mCurrentSpawnNum;

    private IEnumerator Start()
    {
        mCurrentSpawnNum = 0;
        while (true)
        {
            GameObject text = GameObject.Instantiate(Resources.Load("Text2")) as GameObject;
            text.transform.position = transform.position + Vector3.right * Random.Range(-RandomOffset, RandomOffset);
            text.GetComponent<TextScript>().IsWrongText = true;
            GameManager.GetInstance().AddWroneText(text.GetComponent<TextScript>());
            mCurrentSpawnNum++;
            yield return new WaitForSeconds(SpawnInterval);
        }
    }
}
